<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>Cron表达式组件</title>
    <link rel="icon" th:href="@{/images/favicon.ico}">
    <link rel="stylesheet" th:href="@{/layuimini/lib/layui-v2.6.3/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/layuimini/css/public.css}" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="ok-body">
            <blockquote class="layui-elem-quote" style="padding: 5px;">
                1.layui第三方扩展组件：<font color="red" size="2">Cron表达式(cron)</font>；
                <a href="https://gitee.com/candy-boy/laycron" target="_blank" class="layui-btn layui-btn-sm layui-btn-danger">cron</a><br>
                2.本项目主要用于定时任务Cron表达式修改和调整；
            </blockquote>
            <div class="layui-form-item">
                <label class="layui-form-label">Cron表达式</label>
                <div class="layui-input-inline">
                    <input type="text" id="cron"  class="layui-input" value="0 0/5 * * * ?" />
                </div>
            </div>
            <pre>
                // Step1. 定义输入框空间
                <input type="text" id="cron1"  class="layui-input" value="0 0/5 * * * ?" style="width: 200px;margin-left: 110px;"/>
                <br/>
                // Step2. 引入依赖
                let cron = layui.cron;
                <br/>
                // Step3. 使用
                cron.render({
                    elem: "#cron1",      // 绑定元素
                    run: "run.json",    // 获取最近运行时间的接口
                    done: function(cronStr) {
                        console.log(cronStr);
                    }
                });
		    </pre>
        </div>
    </div>
</div>
<!--  引入layui框架js文件-->
<script th:src="@{/layuimini/lib/layui-v2.6.3/layui.js}" charset="utf-8"></script>
<script th:src="@{/layuimini/js/lay-config.js?v=1.0.4}" charset="UTF-8"></script>
<script type="text/javascript" th:inline="javascript">
    layui.use(["code", "cron"], function () {
        let code = layui.code;
        let cron = layui.cron;
        let $ = layui.jquery;

        let ctxPath = /*[[@{/}]]*/'';

        code({
            elem: "pre",
            title: "代码示例",
            encoded: true,
            skin:'notepad', //设置显示风格
            about: false
        });

        cron.render({
            elem: "#cron", // 绑定元素
            run: ctxPath+"develop/component/cronNextTimes", // 获取最近运行时间的接口
            done: function(cronStr) {
                console.log(cronStr);
            }
        });
    });
</script>
</body>
</html>
